﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Scoreboard.Basement.ViewModels;
using Scoreboard.Basement;
using Microsoft.Practices.Composite.Presentation.Commands;

namespace Scoreboard.Author
{
	public class ViewModel : DialogViewModel
	{
		public ViewModel()
		{
			InitialTitle = "Автор";
			AlternateTitle = "Оставить отзыв";
			HasCloseButton = true;

			WindowWidth = 570;

			ShowFeedbackFormCommand = new DelegateCommand<object>(ShowFeedbackFormCommandHandler);
			ShowAuthorCommand = new DelegateCommand<object>(ShowAuthorCommandHandler);
			CloseCommand = new DelegateCommand<object>(CloseCommandHandler);
			SendFeedbackCommand = new DelegateCommand<object>(SendFeedbackCommandHandler);

			/*InitialCommands.Add(new UserCommand("Оставить отзыв", ShowFeedbackFormCommand));
			AlternateCommands.Add(new UserCommand("Отправить", SendFeedbackCommand));
			AlternateCommands.Add(new UserCommand("Вернуться", ShowAuthorCommand));*/

			var closeCommand = new UserCommand("Закрыть", CloseCommand);

			InitialCommands.Add(closeCommand);
			AlternateCommands.Add(closeCommand);
		}

		public ICommand ShowFeedbackFormCommand { get; private set; }
		public ICommand ShowAuthorCommand { get; private set; }
		public ICommand CloseCommand { get; private set; }
		public ICommand SendFeedbackCommand { get; private set; }

		private void ShowFeedbackFormCommandHandler(object parameter)
		{
			NavigateToAlternatePanel();
		}

		private void ShowAuthorCommandHandler(object parameter)
		{
			NavigateToInitialPanel();
		}

		private void CloseCommandHandler(object parameter)
		{
			CloseWindow();
		}

		private void SendFeedbackCommandHandler(object parameter)
		{
			CloseWindow();
		}
	}
}
